/**
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.lookahead.parent.apidoc.enums;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户类型枚举
 *
 * @author LookAhead
 */
@Getter
@AllArgsConstructor
public enum UserEnum {

    WEB("web", "LA管理后台", 0),
    SCHOOL("school", "学校管理后台", 1),
    APP("app", "学生APP", 2),
    COURSEWARE_PAD("courseware_pad", "授课端pad", 2),
    COURSEWARE("courseware", "授课端", 3),
    SCHOOL_APPLET("schoolapplet", "教师小程序（萌熊小管家）", 1),
    STU_APPLET("stuapplet", "家长端小程序（萌熊小助手）", 2),
    DEFAULT("default", "默认用户端", 2),
    ;

    @Schema(description = "用户端名称")
    final String name;

    @Schema(description = "备注")
    final String memo;

    @Schema(description = "用户端分类：0:总后台，1:学校使用，2:学生使用，3:老师使用")
    final int category;

    public static UserEnum getInstance(String name) {
        for (UserEnum userEnum : UserEnum.values()) {
            if (userEnum.name.equals(name)) {
                return userEnum;
            }
        }
        return DEFAULT;
    }

}
